package com.jzo2o.customer.controller.worker;

import com.jzo2o.customer.model.domain.BankAccount;
import com.jzo2o.customer.model.dto.request.BankAccountUpsertReqDTO;
import com.jzo2o.customer.service.IBankAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController("bankAccountController")
@RequestMapping("/worker/bank-account")
@Api(tags = "我的账户设置接口")
public class BankAccountController {
    @Resource
    private IBankAccountService bankAccountService;

    /**
     * 新增或更新银行账户信息
     *
     * @param dto
     */
    @PostMapping
    @ApiOperation("新增或更新银行账户信息")
    public void addOrUpdateBankAccount(@RequestBody BankAccountUpsertReqDTO dto) {
        bankAccountService.addOrUpdateBankAccount(dto);
    }

    /**
     * 获取当前用户银行账号
     *
     * @return
     */
    @GetMapping("/currentUserBankAccount")
    @ApiOperation("获取当前用户银行账号")
    public BankAccount getCurrentUserBankAccount() {
        return bankAccountService.selectCurrentUserBankAccount();
    }
}
